package com.yiren.backstage.currency.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.yiren.backstage.currency.bean.LinePointBean;
import com.yiren.backstage.db.dao.DaoSession;
import com.yiren.backstage.db.dao.LineInfoEntityDao;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Transient;

import java.io.Serializable;
import java.util.List;

import org.greenrobot.greendao.DaoException;

import com.yiren.backstage.db.dao.SiteEntityDao;

/**
 * @author lwb
 * @date : 2022/11/15 14:05
 * @description: 线路
 */
@Entity(nameInDb = "line_entity", createInDb = false)
public class LineInfoEntity implements Serializable {

    private static final long serialVersionUID = 2948363689576984085L;

    @Id
    private String id;

    /*** 外键 */
    private String mapId;

    /*** 线路名称 */
    private String name;

    /*** 考场code */
    private String siteCode;
    @ToOne(joinProperty = "siteCode")
    private SiteEntity siteEntity;

    /*** 创建人 */
    private int userId;

    /*** 线路版本 */
    private float lineVer;

    /*** 使用范围 */
    private int useRange;

    /*** 更新详情 */
    private String updateDetails;

    /*** 更新方式 1：提示更新 2：强制更新 */
    private int updateMode;

    /*** 发布时间 */
    private Long publishTime;

    /*** 0：停用  1：启用 */
    private int state;

    /*** 线路类型 1：考场线路 2：训练线路 */
    private int lineType;

    /*** 合伙人修改数据 */
    private String partneModifyVal;

    /*** 教练修改数据 */
    private String coachModifyVal;

    /***位置信息*/
    private String location;

    /*** 线路经度 */
    private double longitude;

    /*** 线路纬度 */
    private double latitude;

    /*** 点位数*/
    private int pointNumber;

    /*** 线路点位数据 */
    @Transient
    private List<LinePointBean> linePoints;

    /*** 是否更新 */
    @Transient
    private boolean update;

    /*** 否已下载 */
    @Transient
    private boolean downLoad;

    /*** 最新版本号 */
    @Transient
    private float lineVerLast;

    /*** 考场名字 */
    @Transient
    private String siteName;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 441475228)
    private transient LineInfoEntityDao myDao;

    @Generated(hash = 1236995141)
    public LineInfoEntity(String id, String mapId, String name, String siteCode,
            int userId, float lineVer, int useRange, String updateDetails,
            int updateMode, Long publishTime, int state, int lineType,
            String partneModifyVal, String coachModifyVal, String location,
            double longitude, double latitude, int pointNumber) {
        this.id = id;
        this.mapId = mapId;
        this.name = name;
        this.siteCode = siteCode;
        this.userId = userId;
        this.lineVer = lineVer;
        this.useRange = useRange;
        this.updateDetails = updateDetails;
        this.updateMode = updateMode;
        this.publishTime = publishTime;
        this.state = state;
        this.lineType = lineType;
        this.partneModifyVal = partneModifyVal;
        this.coachModifyVal = coachModifyVal;
        this.location = location;
        this.longitude = longitude;
        this.latitude = latitude;
        this.pointNumber = pointNumber;
    }

    @Generated(hash = 739564802)
    public LineInfoEntity() {
    }

    protected LineInfoEntity(Parcel in) {
        id = in.readString();
        mapId = in.readString();
        name = in.readString();
        siteCode = in.readString();
        userId = in.readInt();
        lineVer = in.readFloat();
        useRange = in.readInt();
        updateDetails = in.readString();
        updateMode = in.readInt();
        if (in.readByte() == 0) {
            publishTime = null;
        } else {
            publishTime = in.readLong();
        }
        state = in.readInt();
        lineType = in.readInt();
        partneModifyVal = in.readString();
        coachModifyVal = in.readString();
        location = in.readString();
        longitude = in.readDouble();
        latitude = in.readDouble();
        pointNumber = in.readInt();
        update = in.readByte() != 0;
        downLoad = in.readByte() != 0;
        lineVerLast = in.readFloat();
        siteName = in.readString();
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMapId() {
        return this.mapId;
    }

    public void setMapId(String mapId) {
        this.mapId = mapId;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSiteCode() {
        return this.siteCode;
    }

    public void setSiteCode(String siteCode) {
        this.siteCode = siteCode;
    }

    public int getUserId() {
        return this.userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public float getLineVer() {
        return this.lineVer;
    }

    public void setLineVer(float lineVer) {
        this.lineVer = lineVer;
    }

    public int getUseRange() {
        return this.useRange;
    }

    public void setUseRange(int useRange) {
        this.useRange = useRange;
    }

    public String getUpdateDetails() {
        return this.updateDetails;
    }

    public void setUpdateDetails(String updateDetails) {
        this.updateDetails = updateDetails;
    }

    public int getUpdateMode() {
        return this.updateMode;
    }

    public void setUpdateMode(int updateMode) {
        this.updateMode = updateMode;
    }

    public Long getPublishTime() {
        return this.publishTime;
    }

    public void setPublishTime(Long publishTime) {
        this.publishTime = publishTime;
    }

    public int getState() {
        return this.state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public int getLineType() {
        return this.lineType;
    }

    public void setLineType(int lineType) {
        this.lineType = lineType;
    }

    public String getPartneModifyVal() {
        return this.partneModifyVal;
    }

    public void setPartneModifyVal(String partneModifyVal) {
        this.partneModifyVal = partneModifyVal;
    }

    public String getCoachModifyVal() {
        return this.coachModifyVal;
    }

    public void setCoachModifyVal(String coachModifyVal) {
        this.coachModifyVal = coachModifyVal;
    }

    public String getLocation() {
        return this.location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public int getPointNumber() {
        return this.pointNumber;
    }

    public List<LinePointBean> getLinePoints() {
        return linePoints;
    }

    public void setLinePoints(List<LinePointBean> linePoints) {
        this.linePoints = linePoints;
    }

    public boolean isUpdate() {
        return update;
    }

    public void setUpdate(boolean update) {
        this.update = update;
    }

    public boolean isDownLoad() {
        return downLoad;
    }

    public void setDownLoad(boolean downLoad) {
        this.downLoad = downLoad;
    }

    public float getLineVerLast() {
        return lineVerLast;
    }

    public void setLineVerLast(float lineVerLast) {
        this.lineVerLast = lineVerLast;
    }

    public String getSiteName() {
        return siteName;
    }

    public void setSiteName(String siteName) {
        this.siteName = siteName;
    }

    public void setPointNumber(int pointNumber) {
        this.pointNumber = pointNumber;
    }

    @Generated(hash = 1491111375)
    private transient String siteEntity__resolvedKey;

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 2107179011)
    public SiteEntity getSiteEntity() {
        String __key = this.siteCode;
        if (siteEntity__resolvedKey == null || siteEntity__resolvedKey != __key) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            SiteEntityDao targetDao = daoSession.getSiteEntityDao();
            SiteEntity siteEntityNew = targetDao.load(__key);
            synchronized (this) {
                siteEntity = siteEntityNew;
                siteEntity__resolvedKey = __key;
            }
        }
        return siteEntity;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1985512511)
    public void setSiteEntity(SiteEntity siteEntity) {
        synchronized (this) {
            this.siteEntity = siteEntity;
            siteCode = siteEntity == null ? null : siteEntity.getSiteCode();
            siteEntity__resolvedKey = siteCode;
        }
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 496606239)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getLineInfoEntityDao() : null;
    }

    
}